﻿@model IEnumerable<saigonbook.Biz.BIZ_sach>
<div class="columncenter">
    <div class="header-center">SẢN PHẨM CÙNG LOẠI</div>
    <div style="width:580px">
        @foreach (var item in Model)
        {
            int _gia = (int)item.giaban;
            string gia = _gia.ToString("c");
            gia = gia.Substring(1, gia.LastIndexOf(".") - 1);
            <div class="sanpham">
                <a href="/sach/chitietsanpham?masach=@Html.DisplayFor(modelItem => item.masach).ToString().Trim()"><div><img src="@Url.Content("~/" + @Html.DisplayFor(modelItem => item.hinhanh))" /></div></a>
                <div class="tensanpham" style="color:Black"><table align="center"><tr height="40px" valign="middle"><td><b>@Html.DisplayFor(modelItem => item.tensach)</b></td></tr></table></div>
                <div style="color:#FF0000"><b>Giá: @gia VNĐ</b></div>
                <table>
                        <tr>
                            <td align="right" style="width:100px;padding-left:7px; padding-right:5px">
                                <div class="muahang">
                                @{
                                    saigonbook.Biz.BIZ_tonkho tk = new saigonbook.Biz.BIZ_tonkho();
                                    tk.sach = item;
                                    tk.ngay = DateTime.Now.Date;
                                    if (tk.soluongtonkho(tk) > 0)
                                    { <a title="Thêm sản phẩm vào giỏ hàng" href="/Cart/giohangthem?masach=@Html.DisplayFor(x => item.masach)"><b>Mua hàng</b></a>}
                                    else
                                    { <b title="Hết hàng">Hết hàng</b>}
                                }
                                </div>
                            </td>
                            <td align="left" style="width:60px; padding-left:5px; padding-right:10px">
                                <div class="chitiet">
                                    <a href="/sach/chitietsanpham?masach=@Html.DisplayFor(modelItem => item.masach).ToString().Trim()">Chi tiết</a>
                                </div>
                            </td>
                        </tr>
                    </table>
            </div>
        }
    </div>
    <div class="clear"></div>
        <div style="width:580px; text-align:center; margin: 5px 5px 5px 5px">
    @{Html.RenderAction("Index","paging", new {currentpage = "sach/chitietsanpham?masach="+ @ViewBag.masp, totalpages = ViewBag.TotalPages});}
</div>
    </div>

